<template>
	<view class="container">
		<jyf-parser :html="detail.articleContent" ref="article"></jyf-parser>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				id: '',
				detail: {},
			}
		},
		methods: {
			// 获取文章详情
			async getArticleDetail(id) {
				let res = await this.$fetch(this.$api.get_article_by_id, {
					id: id
				}, 'POST')
				if (res.code) return uni.showToast({
					title: res.msg,
					icon: 'none'
				})
				// console.log('res获取文章详情~~~~', typeof res.data.articleContent, res.data.articleContent)
				res.data.articleContent = res.data.articleContent.replace(/width:/ig, 'aaa')
				this.detail = res.data
				uni.setNavigationBarTitle({
					title: this.detail.articleTitle
				})
			}
		},
		onLoad(options) {
			this.sId = options.id ? options.id : 3
			this.getArticleDetail(this.sId)
		}
	}
</script>
<style lang="less">
	.container {
		padding: 30rpx;
		height: 100%;
		background-color: #FFFFFF;
	}
</style>
